import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		synFirst:0,
		app_logo:'',
		create_key:"",
		gift_index:0,
		create_luttery_goods:[],
		add_fans_config:[],
		user_id_card:{
			username:'',
			id_card:''
		},
		diversion:{},
		gift_code:'',
		show_add_appmini:true,
		is_new:0,
		is_open_notice:0,
		is_config_fans:false
	},
	mutations: {
		changeIsNotice(state,data){
			state.is_open_notice = data
		},
		changeIsNewUser(state,data){
			state.is_new = data
		},
		editAddAppMini(state,data){
			console.log(data)
			state.show_add_appmini = data
			setTimeout(()=>{
				state.show_add_appmini = false
			},15000)
		},
		saveCreateLutteryGoods(state, data){
			state.create_luttery_goods = data;
		},
		saveGiftCode(state, data){
			state.gift_code = data;
		},
		saveDiversion(state, data){
			state.diversion = data;
		},
		giftIndex(state, data){
			state.gift_index = data;
		},
		app_logo(state, data) {
			state.app_logo = data;
		},
		synFirst(state, data) {
			state.synFirst = data;
		},
		createUserIdCard(state, data){
			state.user_id_card = data;
		},
		createKey(state, data){
			state.create_key = data;
		},
		addFansConfig(state, data){ //微信号
			state.add_fans_config[data.index] = data.data;
			state.is_config_fans = true
		},
		clearFansConfig(state,data){
			state.add_fans_config[data.index] = '';
		}
	}
})

export default store
